Fix #50 - Don't show pages if only 1 page
authorjustbur <justin@burkett.cc>
Wed, 22 Jul 2015 14:47:07 +0000 (10:47 -0400)
committerjustbur <justin@burkett.cc>
Wed, 22 Jul 2015 14:47:07 +0000 (10:47 -0400)
which-key.el

index 0964defe89ec85a005292c1393aa4b11408f6ad4..f58a88abf94d3097de55a557d00148164554cfbb 100644 (file)
@@ -956,13 +956,24 @@ enough space based on your settings and frame size." prefix-keys)
              (prefix-left (s-pad-right first-col-width " " prefix-w-face))
              (status-left (s-pad-right first-col-width " " status-left))
              new-end lines)
-        (cond ((eq which-key-show-prefix 'left)
+        (cond ((and (< 1 n-pages)
+                    (eq which-key-show-prefix 'left))
                (setq lines (split-string page "\n")
                      first (concat prefix-left (car lines) "\n" status-left)
                      new-end (concat "\n" (s-repeat first-col-width " "))
                      page  (concat first (mapconcat #'identity (cdr lines) new-end))))
+              ((eq which-key-show-prefix 'left)
+               (if (= 1 height)
+                   (setq page (concat prefix-left page))
+                 (setq lines (split-string page "\n")
+                       first (concat prefix-left (car lines) "\n" (s-repeat first-col-width " "))
+                       new-end (concat "\n" (s-repeat first-col-width " "))
+                       page  (concat first (mapconcat #'identity (cdr lines) new-end)))))
+              ((and (< 1 n-pages)
+                    (eq which-key-show-prefix 'top))
+               (setq page (concat prefix-w-face "-  " status-top "\n" page)))
               ((eq which-key-show-prefix 'top)
-               (setq page (concat prefix-w-face "-  " status-top "\n" page))))
+               (setq page (concat prefix-w-face "-  \n" page))))
         (which-key--lighter-status n-shown n-tot)
         (if (eq which-key-popup-type 'minibuffer)
             (let (message-log-max) (message "%s" page))